﻿/******************************************************************************
 *  All Rights Reserved , Copyright (C) 2012 , EricHu. 
 *  作    者： EricHu
 *  创建时间： 2012-7-20 16:35:54
 ******************************************************************************/

using System;
using System.Data;

namespace RDIFramework.BusinessEntity
{
  using RDIFramework.Utilities;

 /// <summary>
 /// PiUserRoleEntity
 /// 系统用户角色表
 ///
 /// 修改纪录
 ///
 ///		2012-03-02 版本：1.0 EricHu 创建主键。
 ///
 /// 版本：1.0
 ///
 /// <author>
 ///		<name>EricHu</name>
 ///		<date>2012-03-02</date>
 /// </author>
 /// </summary>
 [Serializable]
 public partial class PiUserRoleEntity
 {
  private int? id = null;
  /// <summary>
  /// 主键
  /// </summary>
  public int? Id
  {
      get
      {
          return this.id;
      }
      set
      {
          this.id = value;
      }
  }

  private int? userId = null;
  /// <summary>
  /// 用户主键
  /// </summary>
  public int? UserId
  {
      get
      {
          return this.userId;
      }
      set
      {
          this.userId = value;
      }
  }

  private int? roleId = null;
  /// <summary>
  /// 角色主键
  /// </summary>
  public int? RoleId
  {
      get
      {
          return this.roleId;
      }
      set
      {
          this.roleId = value;
      }
  }

  private int? enabled = 1;
  /// <summary>
  /// 有效
  /// </summary>
  public int? Enabled
  {
      get
      {
          return this.enabled;
      }
      set
      {
          this.enabled = value;
      }
  }

  private String description = string.Empty;
  /// <summary>
  /// 描述
  /// </summary>
  public String Description
  {
      get
      {
          return this.description;
      }
      set
      {
          this.description = value;
      }
  }

  private int? deleteMark = 0;
  /// <summary>
  /// 删除标记
  /// </summary>
  public int? DeleteMark
  {
      get
      {
          return this.deleteMark;
      }
      set
      {
          this.deleteMark = value;
      }
  }

  private DateTime? createOn = DateTime.Now;
  /// <summary>
  /// 创建日期
  /// </summary>
  public DateTime? CreateOn
  {
      get
      {
          return this.createOn;
      }
      set
      {
          this.createOn = value;
      }
  }

  private String createUserId = string.Empty;
  /// <summary>
  /// 创建用户主键
  /// </summary>
  public String CreateUserId
  {
      get
      {
          return this.createUserId;
      }
      set
      {
          this.createUserId = value;
      }
  }

  private String createBy = string.Empty;
  /// <summary>
  /// 创建用户
  /// </summary>
  public String CreateBy
  {
      get
      {
          return this.createBy;
      }
      set
      {
          this.createBy = value;
      }
  }

  private DateTime? modifiedOn = null;
  /// <summary>
  /// 修改日期
  /// </summary>
  public DateTime? ModifiedOn
  {
      get
      {
          return this.modifiedOn;
      }
      set
      {
          this.modifiedOn = value;
      }
  }

  private String modifyUserId = string.Empty;
  /// <summary>
  /// 修改用户主键
  /// </summary>
  public String ModifyUserId
  {
      get
      {
          return this.modifyUserId;
      }
      set
      {
          this.modifyUserId = value;
      }
  }

  private String modifiedBy = string.Empty;
  /// <summary>
  /// 修改用户
  /// </summary>
  public String ModifiedBy
  {
      get
      {
          return this.modifiedBy;
      }
      set
      {
          this.modifiedBy = value;
      }
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  public PiUserRoleEntity()
  {
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataRow">数据行</param>
  public PiUserRoleEntity(DataRow dataRow)
  {
      this.GetFrom(dataRow);
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataReader">数据流</param>
  public PiUserRoleEntity(IDataReader dataReader)
  {
      this.GetFrom(dataReader);
  }

  /// <summary>
  /// 构造函数
  /// </summary>
  /// <param name="dataTable">数据表</param>
  public PiUserRoleEntity(DataTable dataTable)
  {
      this.GetFrom(dataTable);
  }

  /// <summary>
  /// 从数据表读取
  /// </summary>
  /// <param name="dataTable">数据表</param>
  public PiUserRoleEntity GetFrom(DataTable dataTable)
  {
      if ((dataTable == null) || (dataTable.Rows.Count == 0))
      {
          return null;
      }
      foreach (DataRow dataRow in dataTable.Rows)
      {
          this.GetFrom(dataRow);
          break;
      }
      return this;
  }

  /// <summary>
  /// 从数据行读取
  /// </summary>
  /// <param name="dataRow">数据行</param>
  public PiUserRoleEntity GetFrom(DataRow dataRow)
  {
      this.Id = BusinessLogic.ConvertToInt(dataRow[PiUserRoleTable.FieldId]);
      this.UserId = BusinessLogic.ConvertToInt(dataRow[PiUserRoleTable.FieldUserId]);
      this.RoleId = BusinessLogic.ConvertToInt(dataRow[PiUserRoleTable.FieldRoleId]);
      this.Enabled = BusinessLogic.ConvertToInt(dataRow[PiUserRoleTable.FieldEnabled]);
      this.Description = BusinessLogic.ConvertToString(dataRow[PiUserRoleTable.FieldDescription]);
      this.DeleteMark = BusinessLogic.ConvertToInt(dataRow[PiUserRoleTable.FieldDeleteMark]);
      this.CreateOn = BusinessLogic.ConvertToDateTime(dataRow[PiUserRoleTable.FieldCreateOn]);
      this.CreateUserId = BusinessLogic.ConvertToString(dataRow[PiUserRoleTable.FieldCreateUserId]);
      this.CreateBy = BusinessLogic.ConvertToString(dataRow[PiUserRoleTable.FieldCreateBy]);
      this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataRow[PiUserRoleTable.FieldModifiedOn]);
      this.ModifyUserId = BusinessLogic.ConvertToString(dataRow[PiUserRoleTable.FieldModifyUserId]);
      this.ModifiedBy = BusinessLogic.ConvertToString(dataRow[PiUserRoleTable.FieldModifiedBy]);
      return this;
  }

  /// <summary>
  /// 从数据流读取
  /// </summary>
  /// <param name="dataReader">数据流</param>
  public PiUserRoleEntity GetFrom(IDataReader dataReader)
  {
      this.Id = BusinessLogic.ConvertToInt(dataReader[PiUserRoleTable.FieldId]);
      this.UserId = BusinessLogic.ConvertToInt(dataReader[PiUserRoleTable.FieldUserId]);
      this.RoleId = BusinessLogic.ConvertToInt(dataReader[PiUserRoleTable.FieldRoleId]);
      this.Enabled = BusinessLogic.ConvertToInt(dataReader[PiUserRoleTable.FieldEnabled]);
      this.Description = BusinessLogic.ConvertToString(dataReader[PiUserRoleTable.FieldDescription]);
      this.DeleteMark = BusinessLogic.ConvertToInt(dataReader[PiUserRoleTable.FieldDeleteMark]);
      this.CreateOn = BusinessLogic.ConvertToDateTime(dataReader[PiUserRoleTable.FieldCreateOn]);
      this.CreateUserId = BusinessLogic.ConvertToString(dataReader[PiUserRoleTable.FieldCreateUserId]);
      this.CreateBy = BusinessLogic.ConvertToString(dataReader[PiUserRoleTable.FieldCreateBy]);
      this.ModifiedOn = BusinessLogic.ConvertToDateTime(dataReader[PiUserRoleTable.FieldModifiedOn]);
      this.ModifyUserId = BusinessLogic.ConvertToString(dataReader[PiUserRoleTable.FieldModifyUserId]);
      this.ModifiedBy = BusinessLogic.ConvertToString(dataReader[PiUserRoleTable.FieldModifiedBy]);
      return this;
  }
  }
}
